//
//  world_each.hpp
//  cpp_algorithm
//
//  Created by 李贺 on 2021/12/8.
//

#ifndef world_each_hpp
#define world_each_hpp

#include <stdio.h>
#include <vector>
#include <iostream>
#include <string>
using namespace std;

class Solution_world_each {

public:
    
    bool isAnagram(string s1, string s2) {
        int record[26] = {0};
        for (int i = 0; i < s1.size(); i++) {
            record[s1[i] - 'a']++;
        }
        
        for (int j = 0; j < s2.size(); j++) {
            record[s2[j] - 'a']--;
        }
        
        for (int i = 0 ; i < 26; i++) {
            if (record[i] != 0) {
                return  false;
            }
        }
        return true;
    };
    
    void test() {
        
        string s1 = "mymy";
        string s2 = "yymm";
        bool res = isAnagram(s1, s2);
        cout << res << endl;
    };
    
};

#endif /* world_each_hpp */
